package com.example.demo4.dao;

import com.example.demo4.utils.DBConnection;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class AdminDao {
    DBConnection DBConn = new DBConnection();
    /**
     * 方法名:CheckLogin
     * 功能描述:登录验证
     * Created by 天马行空
     */
public boolean CheckLogin( String s1, String s2) throws SQLException {
    Connection conn = DBConn.getConn();
    Statement stmt = conn.createStatement();
    ResultSet rs = null ;
    boolean OK = true;
    String sql = "select * from admin where adminname = '"+s1+"'and" + " adminpwd = '"+s2+"'";
    rs = stmt.executeQuery(sql);
    if(rs.next()){
        OK = false;
    }
    return OK;
    }
}
